<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        function init() {
//            setCookie("a","b")
        }

        //JS操作cookies方法!
        //写cookies
        function setCookie(name,value)
        {
            document.cookie = name + "="+ value;
        }
        function display() {
            alert("cookie = " + document.cookie)

        }
    </script>
</head>
<body onload="init()">
<h1 onclick="display()">ffffffffddddd</h1>
</body>
</html>